import { defineConfig } from 'vite'
import uni from '@dcloudio/vite-plugin-uni'

export default defineConfig({
  plugins: [uni()],
  resolve:{
      alias:{
        '@':'/src'
      }
    },
	server:{
	    proxy:{
	      "/d/home":{
	        target:'http://8.137.157.16:9999',
	        changeOrigin:true,
	        rewrite:(path)=>path.replace('/d/home','/home')
	      },
		  "/d/weappUser":{
		    target:'http://8.137.157.16:9999',
		    changeOrigin:true,
		    rewrite:(path)=>path.replace('/d/weappUser','/weappUser')
		  },
		  "/d/manageLeft":{
		    target:'http://8.137.157.16:9999',
		    changeOrigin:true,
		    rewrite:(path)=>path.replace('/d/manageLeft','/manageLeft')
			},
		  "/d/manageRight":{
		    target:'http://8.137.157.16:9999',
		    changeOrigin:true,
		    rewrite:(path)=>path.replace('/d/manageRight','/manageRight')
		  },
		  "/d/liveStock":{
		    target:'http://8.137.157.16:9999',
		    changeOrigin:true,
		    rewrite:(path)=>path.replace('/d/liveStock','/public/imgUpload')
		  },
		  "/d/trace":{
		    target:'http://8.137.157.16:9999',
		    changeOrigin:true,
		    rewrite:(path)=>path.replace('/d/trace','/trace')
		  },
		  "/d/map":{
		    target:'http://8.137.157.16:9999',
		    changeOrigin:true,
		    rewrite:(path)=>path.replace('/d/map','/map')
		  },
		  "/d/home/getDevices":{
		    target:'http://8.137.157.16:9999',
		    changeOrigin:true,
		    rewrite:(path)=>path.replace('/d/home/getDevices','/home/getDevices')
		  },
	    }
	  }
}) 